package com.example.webchar.webchar.mapper.slave;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.webchar.webchar.pojo.ChapterName;
import com.example.webchar.webchar.pojo.NovelContent;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: wechat-web-is-my
 * @description
 * @author: 郭逍
 * @create: 2021/8/21 10:57
 **/
@Mapper
@Service
public interface NovelContentSlave extends BaseMapper<NovelContent> {
    /**
     * 根据chapterName表中的Id信息 返回当前章节的内容
     *
     * @param chapterNames
     * @return
     */
    @Select("<script> select * from novel_content where chapter_name_id in <foreach  item='item' index='index' collection='chapterNames' open='(' separator=',' close=')'> #{item.id}</foreach> </script>")
    List<NovelContent> queryContentByChapterList(@Param("chapterNames") List<ChapterName> chapterNames);
}
